package org.casper.outofmemory;

public class TestArray {

	/**
	 * 演示异常:java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	 */
	@SuppressWarnings("unused")
	public static void main(String[] args) {
		try {
			int[] arr = new int[Integer.MAX_VALUE - 1];
			System.err.println("initial array size: " + Integer.MAX_VALUE);
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}
}
